import rospy
from plumbing_c_s.srv import *
import sys

if __name__ == '__main__':
    rospy.init_node("client_py")
    if len(sys.argv) != 3:
        rospy.loginfo("输入参数有误!")
        sys.exit(1)
    my_client = rospy.ServiceProxy("addInts", AddInts)
    # 如果服务端没有启动，等待服务端启动
    my_client.wait_for_service()
    request = AddIntsRequest()
    num1 = sys.argv[1]
    num2 = sys.argv[2]
    request.num1 = int(num1)
    request.num2 = int(num2)
    response = my_client.call(request)

    rospy.loginfo("返回结果:%d", response.sum)
